home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 9
/
FM Towns Free Software Collection 9.iso
/
t_os
/
tool
/
vdgear
/
src
/
main.c
< prev
next >
Wrap
Text File
|
1994-11-16
|
9KB
|
460 lines
/*
* VIDEO・GEAR
* "main.c"
* by Good-Chy
*/
#define MAIN
#include "video.h"
void TM_main();
void title_print()
{
set_palette(9,0,0,0);
sprint("easy operation video effecter",204,222,9,0,16,16,1);
sprint("--- VIDEO GEAR ---",204,240,9,0,16,16,1);
sprint("for FM-Towns 1993 by Good-Chy",204,258,9,0,16,16,1);
}
void all_clear() /* デ-タの初期化 */
{
int i;
for (i=0 ; i<48 ; i++)
{
data[i].effect.flag = 0;
data[i].picture.flag = 0;
data[i].cd.flag = 0;
data[i].sound.flag = 0;
data[i].mixing.flag = 0;
}
}
void all_clear_sub()
{
close();
all_clear();
step_print();
}
void all_clear_win()
{
con_win(1);
}
void select()
{
close();
switch((win[0].last->number)%5)
{
case 0: video_win(); break;
case 1: picture(); break;
case 2: cd_win(); break;
case 3: sound_win(); break;
case 4: mixing(); break;
}
}
void els()
{
int stp;
stp = step + (win[0].last->number)/5;
switch((win[0].last->number)%5)
{
case 0:data[stp].effect.flag = 0; break;
case 1:data[stp].picture.flag = 0; break;
case 2:data[stp].cd.flag = 0; break;
case 3:data[stp].sound.flag = 0; break;
case 4:data[stp].mixing.flag = 0; break;
}
close();
step_print();
}
void inst() /* 挿入 */
{
int i,stp,dx,dy;
char *p;
setmos(82);
stp = step + (win[0].last->number)/5;
for (i=46 ; i>=stp ; i--)
{
switch((win[0].last->number)%5)
{
case 0: /* ビデオ画像 */
{
memcpy( &data[i+1].effect, &data[i].effect,
sizeof(EFFECT));
break;
}
case 1: /* パソコン画像 */
{
memcpy( &data[i+1].picture, &data[i].picture,
sizeof(PICTURE));
EGB_writePage(egb_work,0x81);
dx = i % 8 * 40;
dy = i / 8 * 30+60;
p = get_vram(32,dx,dy,dx+39,dy+29);
dx = (i+1) % 8 * 40;
dy = (i+1) / 8 * 30+60;
put_vram(p,dx,dy,dx+39,dy+29);
free(p);
EGB_writePage(egb_work,0);
break;
}
case 2: /* CD */
{
memcpy( &data[i+1].cd, &data[i].cd,
sizeof(CD));
break;
}
case 3: /* 効果音 */
{
memcpy( &data[i+1].sound, &data[i].sound,
sizeof(SOUND));
break;
}
case 4: /* ミキシング */
{
memcpy( &data[i+1].mixing, &data[i].mixing,
sizeof(MIXING));
break;
}
}
}
els();
setmos(81);
}
void del() /* 削除 */
{
int i,stp,dx,dy;
char *p;
setmos(82);
close();
stp = step + (win[0].last->number)/5;
for (i=stp ; i<47 ; i++)
{
switch((win[0].last->number)%5)
{
case 0: /* ビデオ画像 */
{
memcpy( &data[i].effect, &data[i+1].effect,
sizeof(EFFECT));
data[47].effect.flag = 0;
break;
}
case 1: /* パソコン画像 */
{
memcpy( &data[i].picture, &data[i+1].picture,
sizeof(PICTURE));
data[47].picture.flag = 0;
EGB_writePage(egb_work,0x81);
dx = (i+1) % 8 * 40;
dy = (i+1) / 8 * 30+60;
p = get_vram(32,dx,dy,dx+39,dy+29);
dx = i % 8 * 40;
dy = i / 8 * 30+60;
put_vram(p,dx,dy,dx+39,dy+29);
free(p);
EGB_writePage(egb_work,0);
break;
}
case 2: /* CD */
{
memcpy( &data[i].cd, &data[i+1].cd,
sizeof(CD));
data[47].cd.flag = 0;
break;
}
case 3: /* 効果音 */
{
memcpy( &data[i].sound, &data[i+1].sound,
sizeof(SOUND));
data[47].sound.flag = 0;
break;
}
case 4: /* ミキシング */
{
memcpy( &data[i].mixing, &data[i+1].mixing,
sizeof(MIXING));
data[47].mixing.flag = 0;
break;
}
}
}
setmos(81);
step_print();
}
void menu()
{
BUTTON *p;
int vx, vy;
vx = win[active].last->bx+2;
vy = win[active].last->dy+2;
p = window_open(vx,vy,74,94,0,0);
p = create(p, 6, 6,62,15,1,select);
p = create(p, 6,22,62,15,1,inst);
p = create(p, 6,38,62,15,1,els);
p = create(p, 6,54,62,15,1,del);
p = create(p,34,72,31,17,0,close);
}
void _load()
{
file_sel(0);
}
void _save()
{
file_sel(1);
}
void file_win() /* ファイル選択ウィンドウ */
{
BUTTON *p;
p = window_open(545,40,61,63,578,0);
p = create(p, 6, 6,49,15,1,_load);
p = create(p, 6,23,49,15,1,_save);
p = create(p,21,41,31,17,0,close);
}
void mixing_print(int stp, int vx)
{
if (data[stp].mixing.flag == 1)
{
sprint("設定あり",vx*89+110,359,15,0,16,16,1);
}
}
void step_print()
{
int i;
int dx;
EGB_paintMode(egb_work,0x22);
EGB_writePage(egb_work,0);
for (i=0 ; i<5 ; i++)
{
box_full(i*89+130,89,i*89+153,101,1,1,0);
sprintusing(step+i+1,2,i*89+129,101,15,8,24,12,4);
EGB_writePage(egb_work,1);
dx = (i*89+102)/2;
box_full(dx,56,dx+39,85,0,0,0); /* エフェクト消去 */
box_full(dx,91,dx+39,120,0,0,0); /* ピクチャ-消去 */
EGB_writePage(egb_work,0);
box_full(102+i*89,252,181+i*89,283,0,0,0);/* CD消去 */
box_full(102+i*89,294,181+i*89,325,0,0,0);/* 効果音消去 */
box_full(102+i*89,336,181+i*89,367,0,0,0);/* ミキシング消去 */
if (data[step+i].effect.flag == 1)
{ effect_print(data[step+i].effect.effect-1,dx,56); }
if (data[step+i].picture.flag == 1)
{ picture_print(step+i,dx,91); }
if (data[step+i].cd.flag == 1)
{ cd_print(i); }
if (data[step+i].sound.flag == 1)
{ sound_print(i); }
if (data[step+i].mixing.flag == 1)
{ sprint("設定あり",i*89+110,359,15,0,16,16,1); }
}
}
void search()
{
int sw;
sw = win[active].last->number;
switch(sw)
{
case 25 : step -= 5 ; break;
case 26 : step -- ; break;
case 27 : step ++ ; break;
case 28 : step += 5 ; break;
}
if (step< 0) { step = 0; }
if (step>43) { step = 43; }
step_print();
}
void main(int ac, char *av[])
{
TM_main();
int i;
BUTTON *ret, *push;
int button, mos_x, mos_y;
int count, glab, interval;
active = 0; step = 0; key_flag = 0;
work_path = NULL;
char *p; /* パラメ-タの設定 */
av_flag = 0;
sp_light = 0x81;
fade_speed = 1;
effect_speed = 1;
while ( --ac > 0 )
{
p = *(++av);
if ( *p == '/' )
{
switch(*(++p))
{
case 'M': case 'm': av_flag = 1; break;
case 'D': case 'd': sp_light = 0x80; break;
case 'F': case 'f': fade_speed = atoi(++p); break;
case 'E': case 'e': effect_speed = atoi(++p); break;
}
}
}
screen1();
SND_init(snd_work);
MOS_start(mos_work,4096);
snd_init();
mos_init();
kana_init();
title_print();
for (i=0 ; i<256 ; i+=2) { set_palette(9,i,i,i); }
toc_read();
work_path = _getcwd(work_path,255);
snd_bp = malloc(1);
main_screen_load();
all_clear();
step_print();
ret = (BUTTON *)malloc(sizeof(BUTTON)); /* ベ-スのボタン作成 */
win[active].item = ret;
win[active].wx = 0;
win[active].wy = 0;
win[active].item->number = 0;
for (i=0 ; i<5 ; i++)
{
ret = create(ret, 102+i*89, 112, 79, 59, 1, menu);
ret = create(ret, 102+i*89, 182, 79, 59, 1, menu);
ret = create(ret, 102+i*89, 252, 79, 31, 1, menu);
ret = create(ret, 102+i*89, 294, 79, 31, 1, menu);
ret = create(ret, 102+i*89, 336, 79, 31, 1, menu);
}
ret = create(ret, 404, 393, 30, 30, 0,search);
ret = create(ret, 444, 393, 30, 30, 0,search);
ret = create(ret, 484, 393, 30, 30, 0,search);
ret = create(ret, 524, 393, 30, 30, 0,search);
ret = create(ret, 480, 9, 30, 30, 0,all_clear_win);
ret = create(ret, 520, 9, 30, 30, 0,play);
ret = create(ret, 560, 9, 30, 30, 0,file_win);
ret = create(ret, 600, 9, 30, 30, 0,close);
count = 0;
glab = 0;
interval = 0;
for (;;)
{
MOS_rdpos(&button, &mos_x, &mos_y);
if (key_flag == 1)
{
line_input();
}
if ((button & 1) == 1)
{
if (count == 0)
{
count = 1;
ret = check_button(mos_x, mos_y);
push = ret;
if (ret != NULL)
{
drow(push);
glab = 1;
}
}
else
{
ret = check_button(mos_x, mos_y);
if ((glab == 1) && (push != ret))
{
drow(push);
glab = 0;
}
ret = check_button(mos_x, mos_y);
if ((glab == 0) && (push == ret) && (ret != NULL))
{
drow(ret);
glab = 1;
}
if ((ret != NULL) && (glab == 1) && (ret->type == 2))
{
if (interval < 302) { interval++; }
if ((interval == 1) || (interval > 300))
{
win[active].last = push;
(*(ret->function))();
}
}
}
}
else
{
if (count == 1)
{
if ((button & 1) == 0)
{
count = 0;
interval = 0;
if (glab == 1)
{
glab = 0;
win[active].last = push;
drow(push);
if (ret->type != 2)
{
(*(push->function))();
}
}
}
}
}
}
}